home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / fontutil.6 / fontutil / fontutils-0.6 / bin / pcharstr < prev    next >
Encoding:
Text File  |  1992-05-18  |  1009 b   |  46 lines

  1. #!/bin/sh
  2. # Print the encrypted and encoded charstrings (i.e., the CharStrings and
  3. # Subrs dictionaries) in a font.  This uses the `pcharstr.ps' file that
  4. # comes with Ghostscript.
  5.  
  6. if test $# -lt 1 -o $# -gt 2
  7. then
  8.   echo "Usage: $0 <filename>[.gsf] [<FontName>]."
  9.   exit 1
  10. fi
  11.  
  12. filename=$1
  13.  
  14. # If the filename has no extension, add .gsf.
  15. if echo `basename $filename` | grep '\.' > /dev/null 2>&1
  16. then :
  17. else filename=$filename.gsf
  18. fi
  19.  
  20. # If the fontname wasn't given, guess it from the `%!' line in the file.
  21. # We look for the file in the current directory only, so this loses for
  22. # fonts which are in the GS directory.
  23. if test -z "$2"
  24. then
  25.   if test -r $filename
  26.   then fontname=`sed -n 's/^%!FontType.* \(.*\) .*$/\1/p' < $filename`
  27.   fi
  28. else
  29.   fontname=$2
  30. fi
  31.  
  32. if test -z "$fontname"
  33. then
  34.   echo "Can't guess FontName; please supply it."
  35.   exit 1
  36. fi
  37.  
  38. gsnd - << eof
  39. ($filename)run
  40. (pcharstr.ps)run
  41. /$fontname findfont setfont
  42. currentfont /FontName get (Ugly) eq { (No font.) == quit } if
  43. ()= printfont
  44. eof
  45.